﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace Wpf学习
{
    #region ObjectEditor与IDE的相关事件    
    public delegate void ObjectEditorCloseEventHandler();
    public delegate void ObjectEditorSaveEventHandler();
    public delegate void ObjectEditorCloseAndSaveEventHandler();
    #endregion

    public abstract class ObjectEditorUserControl : UserControl
    {
        //关闭事件
        public event ObjectEditorCloseEventHandler OnCloseObjectEvent = null;
        //保存事件
        public event ObjectEditorSaveEventHandler OnSaveObjectEvent = null;
        //关闭并保存事件
        public event ObjectEditorCloseAndSaveEventHandler OnCloseAndSaveObjectEvent = null;
        //Info选项卡
        public InfosTabItem InfosTabItem = new InfosTabItem();
        private void CloseObjectClick(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("关闭对象");
            OnCloseObjectEvent?.Invoke();
        }
        private void SaveObjectClick(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("保存对象");
            OnSaveObjectEvent?.Invoke();
        }
        private void CloseAndSaveObjectClick(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("关闭和保存对象");
            OnCloseAndSaveObjectEvent?.Invoke();
        }
        public TabItem GetTabItem()
        {
            MessageBox.Show("生成一个 TableItem选项卡");
            TabItem tabItem = new TabItem();
            //tabItem.Header = 
            return tabItem;
        }
    }
}
